package w;

import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;
public class CalculatorTest {
    private Calculator calculator=new Calculator();
    @Before
    public void setUp() throws Exception {
    }
    @Test
    public void testDnj() {
        calculator.Dnj(0, 1, 2, 4);
        assertEquals(3,calculator.getSum());
        calculator.Dnj(1, 1, 1, 1);
        assertEquals(0,calculator.getSum()); 
        calculator.Dnj(2, 1, 1, 1);
        assertEquals(1,calculator.getSum());
        calculator.Dnj(3, 1, 1, 1);
        assertEquals(1,calculator.getSum());
         
    }  
    @Test
    public void testGnj() {
        calculator.Gnj(0, 0, 1, 1, 1, 1, 1);
        assertEquals(3,calculator.getSum());
        calculator.Gnj(0, 1, 1, 1, 1, 1, 1);
        assertEquals(1,calculator.getSum());      
        calculator.Gnj(0, 2, 1, 1, 1, 1, 1);
        assertEquals(2,calculator.getSum());
        calculator.Gnj(0, 3, 1, 1, 1, 1, 1);
        assertEquals(2,calculator.getSum());
        
        calculator.Gnj(1, 0, 1, 1, 1, 1, 1);
        assertEquals(1,calculator.getSum());
        calculator.Gnj(1, 1, 3, 1, 1, 1, 1);
        assertEquals(1,calculator.getSum());      
        calculator.Gnj(1, 2, 1, 1, 1, 1, 1);
        assertEquals(0,calculator.getSum());
        calculator.Gnj(1, 3, 1, 1, 1, 1, 1);
        assertEquals(0,calculator.getSum());
        
        
        calculator.Gnj(2, 0, 1, 1, 1, 1, 1);
        assertEquals(2,calculator.getSum());
        calculator.Gnj(2, 1, 1, 1, 1, 1, 1);
        assertEquals(0,calculator.getSum());      
        calculator.Gnj(2, 2, 1, 1, 1, 1, 1);
        assertEquals(1,calculator.getSum());
        calculator.Gnj(2, 3, 1, 1, 1, 1, 1);
        assertEquals(1,calculator.getSum());
       
        calculator.Gnj(3, 0, 1, 1, 1, 1, 1);
        assertEquals(2,calculator.getSum());
        calculator.Gnj(3, 1, 1, 1, 1, 1, 1);
        assertEquals(0,calculator.getSum());      
        calculator.Gnj(3, 2, 1, 1, 1, 1, 1);
        assertEquals(1,calculator.getSum());
        calculator.Gnj(3, 3, 1, 1, 1, 1, 1);
        assertEquals(1,calculator.getSum());
        
        
    }   


}